package com.wsx.rpc.spi;

import com.wsx.rpc.spi.service.LoadDataService;

import java.util.Map;
import java.util.ServiceLoader;

/**
 * @author wangshuaixin
 * @Title: com.wsx.rpc.spi.SpiApplication
 * @Description: TODO
 * @date 2018/12/21
 */
public class SpiApplication {

    public static void main(String[] args) {

        ServiceLoader<LoadDataService> serviceLoader = ServiceLoader.load(LoadDataService.class);
        try {
            serviceLoader.forEach(loadDataService -> {
                loadDataService.init();
                Map<String, Object> map = loadDataService.getDatas();
                for (Map.Entry<String, Object> entry : map.entrySet()) {
                    System.out.println(entry.getKey() + "==" + entry.getValue());
                }
            });
        } catch (Exception e) {

        }
    }
}
